package com.example.demo;

import java.util.Random;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
//        Scanner in = new Scanner(System.in);
//        int n = in.nextInt();
        long An = 20L;
        long Bn = 20L;
        long Sn = 0L;
        long Cn= 0L;
        long Ln;
        long LHn = 0L;

        for (int i = 0; i < 25; i++) {
            An = (An-10)*5 + 30;
            Sn = Sn + An;
            //次数
            Cn = Sn/10;
        }
        for (int i = 0; i < 24; i++) {
            Bn = (Bn-10)*5 + 30;
            Ln=(Bn/10)-1;
            LHn = LHn + Ln;
        }
        System.out.println("来回次数一共："+LHn+1+"次");
        System.out.println("行驶距离一共"+Sn+"km");
        System.out.println("一共要加"+Cn+"油");
    }
}
class Test2{
    public static void main(String[] args) {

        double x=0;
        double La=0;
//        long Cn= 500L;
        double Sn = 0;
        for (;;) {
//            double n=random.nextInt(max+min)+min;
//            float n= (float) Math.random();
               Random random = new Random();
               double n = random.nextDouble();
               n*=50;
            if (n>25){
                for (int j = 0; j < n; j++) {
                    n=n/2;
                    if (n<=25){
                        double v = Math.pow(2, j + 2);
                        double v1=Math.pow(2, j + 2)-2;
                        x= (int) ((v1*n)/v);
                        n= (int) (n*v);
                        Sn = Sn + n;
                        La = La + x;
                    }
                    if (La != 500){
                        n = random.nextDouble();
                    }
                    if (La==500){
                        System.out.println(La);
                        System.out.println(Sn);
                        break;
                    }
                }}
            if (n<25){
                for (int j = 0; j < n; j++) {
                    n=n/2;
                    if (n<=25){
                        double v = Math.pow(2, j + 2);
                        double v1=Math.pow(2, j + 2)-2;
                        x= (int) ((v1*n)/v);
                        n= (int) (n*v);
                        Sn = Sn + n;
                        La = La + x;
                    }
                    if (La != 500){
                        n = random.nextDouble();
                    }
                    if (La==500){
                        System.out.println(La);
                        System.out.println(Sn);
                        break;

                    }
                }
            }
            }

//        }


//
          }
}
